package cn.aj.basic.config;

import cn.aj.basic.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
* @Description: TODO
* @Author: aj
* @Version: 1.0
* @Date:  2022/11/26 0026 19:15
 * spring中配置拦截名单
*/
@Configuration
public class LoginConfig implements WebMvcConfigurer {

    @Autowired
    private LoginInterceptor loginInterceptor;

    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                // 拦截所有
                .addPathPatterns("/**")
                // 放行登录下面所有的接口
                .excludePathPatterns("/login/**")
                // 放行图上传下面所有
                .excludePathPatterns("/fastdfs/**")
                // 放行店铺注册下面所有
                .excludePathPatterns("/shop/settlement/**")
                // 放行验证码下面所有
                .excludePathPatterns("/verifyCodeImage/**")
                .excludePathPatterns("/user/phone/**").excludePathPatterns("/user/email/**");




    }

}
